package com.wh.hotel.global;

import com.wh.common.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author luweije
 */
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler({Exception.class})
    public Result<String> hotelExceptionHandler(Exception e) {
        log.error("全局异常捕获", e);
        return Result.failResponse(e.getMessage());
    }
}
